﻿
namespace MyFloridaHouse.libSvOpenDistricts.ViewModel
{
    public partial class ViewModelBase
    {
        #region properties
        private bool _isLeftMenuVisible = true;
        public bool isLeftMenuVisible
        {
            get { return _isLeftMenuVisible; }
            set
            {
                if (_isLeftMenuVisible != value)
                {
                    _isLeftMenuVisible = value;
                    NotifyPropertyChanged("isLeftMenuVisible");
                    NotifyPropertyChanged("leftMenuCommandLabel");
                }
            }
        }
        public string leftMenuCommandLabel
        {
            get 
            {
                if (isLeftMenuVisible)
                {
                    return "<<";
                }
                else
                {
                    return ">>";
                }
            }
        }

        private double _leftMenuColumnWidth = 0.0;
        public double leftMenuColumnWidth
        {
            get
            {
                if (isLeftMenuVisible)
                {
                    return _leftMenuColumnWidth;
                }
                else
                {
                    NotifyPropertyChanged("saveLeftMenuColumnWidth");
                    return 0;
                }
            }
            set
            {
                // don't raise property changed, cause that will cause an infinite loop
                _leftMenuColumnWidth = value;
            }

        }

        #endregion        #endregion

        #region Commands
        private bool CmdToggleShowLeftMenuCanExecute(object parameter)
        {
            return true;
        }

        private void CmdToggleShowLeftMenuExecute(object parameter)
        {
            if (isLeftMenuVisible)
            {
                isLeftMenuVisible = false;
            }
            else
            {
                isLeftMenuVisible = true;
            }
        }
        #endregion

    }
}

